package mt.comm;

import java.io.Serializable;

import mt.Order;

public class ClienteSideOrderMessage implements Serializable,ClientSideMessage  {
	

	private Type type;
	private Order order;
	private String nickname;
	private String error;
	
	
	public ClienteSideOrderMessage(Type type, Order order, String nickname, String error){
		this.type=type;
		this.order=order;
		this.nickname=nickname;
		this.error=error;
	}
	
	public ClienteSideOrderMessage createOrderMessage(Order order){
		ClienteSideOrderMessage message = new ClienteSideOrderMessage(Type.ORDER, order, order.getNickname(), null);
		return message;
	}
	
	public ClienteSideOrderMessage errorOrderMessage(String error, String nickname){
		ClienteSideOrderMessage message = new ClienteSideOrderMessage(Type.ORDER, null, nickname, error);
		return message;
	}

	@Override
	public Type getType() {
		// TODO Auto-generated method stub
		return type;
	}

	@Override
	public Order getOrder() {
		// TODO Auto-generated method stub
		return order;
	}

	@Override
	public String getError() {
		// TODO Auto-generated method stub
		return error;
	}

}
